package com.xdap.keymen.config;

import com.xdap.keymen.filter.DouYinRequestContentCacheFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class KeymenConfiguration implements WebMvcConfigurer {
    @Autowired
    private DouYinRequestContentCacheFilter douYinRequestContentCacheFilter;

    @Bean
    public FilterRegistrationBean filterRegistration() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.setFilter(this.douYinRequestContentCacheFilter);
        filterRegistrationBean.setName("douYinRequestContentCacheFilter");
        filterRegistrationBean.addUrlPatterns("/*");
        filterRegistrationBean.setOrder(-99999999);
        return filterRegistrationBean;
    }
}
